/** @file               sw_cond.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_COND_H__
#define __SW_COND_H__

#if !defined(WIN32) || defined(__MINGW32__) || defined(SW_V_WITH_PTHREAD)
#include <pthread.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if defined(WIN32) && !defined(__MINGW32__) && !defined(SW_V_WITH_PTHREAD)
typedef CONDITION_VARIABLE *SW_COND;
#define SW_INVALID_COND NULL
#else
typedef pthread_cond_t *SW_COND;
#define SW_INVALID_COND NULL
#endif

SW_API SW_RET SW_InitCondAPI(SW_VOID);
SW_API SW_RET SW_RunCondAPI(SW_VOID);
SW_API SW_RET SW_StopCondAPI(SW_VOID);
SW_API SW_RET SW_ExitCondAPI(SW_VOID);
SW_API SW_COND SW_CreateCond(SW_VOID);
SW_API SW_RET SW_DeleteCond(SW_COND cond);
SW_API SW_RET SW_WaitCond(SW_COND cond, SW_MUTEX mtx);
SW_API SW_RET SW_TimeWaitCond(SW_COND cond, SW_MUTEX mtx, SW_UINT32 msec);
SW_API SW_RET SW_SignalCond(SW_COND cond);
SW_API SW_RET SW_BroadcastCond(SW_COND cond);

#ifdef __cplusplus
}
#endif

#endif

